/*
#include <iostream>
#include <queue>

using namespace std;

struct node
{
	int v;
	node* next;
	node(int x, node* t)
	{
		v = x;
		next = t;
	}
};
typedef node *List;

// Graph representation via an adjacency list
struct graph
{
	int n; // Number of vertices
	List *adj; // Adjacency list
	int *mark; // Marks of nodes
	int *value; // Values for each node ; here = BFS arrival time
	int *npaths;
	// Constructor
	graph(int x)
	{
		n = x;
		adj = new List[n];
		mark = new int[n];
		value = new int[n];
		npaths = new int[n];
	}
	// Output for debugging purposes
	void dumpgraph()
	{
		cout << "Dumping graph G with" << n << "nodes\n";
		for (int i = 0; i < n; i++)
		{
			cout << "Node" << i << " mark " << mark[i] << " value " << value[i]
					<< endl;
			for (List u = adj[i]; u != NULL; u = u->next)
				cout << u->v << " ";
			cout << endl;
		}
		cout << "-----\n";
	}
};
typedef graph *Graph;

 ----------------------------------------------

// inputGraph:  Read from cin the edgelist of an undirected graph
void inputGraphTwo(Graph G, int n, int m)
{
	G->n = n;
	for (int i = 0; i < n; i++)
		G->adj[i] = NULL;
	for (int i = 0; i < m; i++)
	{
		int u, v;
		cin >> u >> v;
		G->adj[u] = new node(v, G->adj[u]);
		G->adj[v] = new node(u, G->adj[v]);
	}
}

// --------------------------------------------------------------------

const int WHITE = 0;
const int GREY = 1;
const int BLACK = 2;
int numberOfVerteces[10] =
{ 0 };
int numberOfEdges[10] =
{ 0 };

void DFS(Graph G, int k)
{
	G->mark[k] = BLACK; // Record that node k has been visited
	for (List t = G->adj[k]; t != NULL; t = t->next)
	{
		if (!G->mark[t->v])
			DFS(G, t->v); // ..then visit him..
	}
}

void ccDFS(Graph G, int u, int ccno)
{
	G->mark[u] = GREY; // Record that node k has been visited
	G->value[u] = ccno;
	numberOfVerteces[ccno] += 1;
	for (List t = G->adj[u]; t != NULL; t = t->next)
	{
		if (!G->mark[t->v])
		{
			numberOfEdges[ccno] += 1;
			ccDFS(G, t->v, ccno); // ..then visit him..
		}
		G->mark[u] = BLACK;
	}
}

bool pseudoForest(Graph G)
{
	int ccno = 1;
	for (int v = 0; v < G->n; v++)
	{
		if (G->mark[v] == WHITE)
		{
			ccDFS(G, v, ccno);
			ccno++;
		}
	}
	cout << "ccno: " << ccno << endl;
	if (ccno == 1)
	{
		return true;
	}
	else
	{
		for (int i = 1; i < ccno; ++i)
		{
			for (int j = 1; j < ccno; ++j)
			{
				if (numberOfEdges[i] != numberOfEdges[j])
				{
					return false;
				}
				if (numberOfVerteces[i] != numberOfVerteces[j])
				{
					return false;
				}
			}
		}
	}
	return true;
}

int main()
{
	int n, m;
	cin >> n >> m;
	Graph G = new graph(n);
	inputGraphTwo(G, n, m);

	cout << "Pseudoforest: " << (pseudoForest(G) ? "Yes" : "No") << endl;
	for (int i = 0; i < 10; ++i)
	{
		cout << "ccno: " << i << " verteces: " << numberOfVerteces[i]
				<< " edges: " << numberOfEdges[i] << endl;
	}
	cout.precision(2);
}

*/
